<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card layui-form">
                <div class="layui-card-body">
                    <div class="layui-container" style="padding-bottom: 50px">
                        <form class="layui-form" action="" id="bankForm">
                            <input type="text" value="${bank.id}" hidden="hidden" name="id" >
                            <div class="layui-form-item">
                                <label class="layui-form-label" >真实姓名</label>
                                <div class="layui-input-inline">
                                    <input type="text" value="${bank.realName}" name="realName" required  lay-verify="required" placeholder="请输入真实姓名" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">请选择银行卡类型</label>
                                <div class="layui-input-inline">
                                    <select name="typeId" lay-verify="required">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${banktype}" var="c">
                                            <option value="${c.id}" selected="${bank.type==c.id?'selected':''}"  data-iconurl=""> ${c.bankName}</option>
                                        </c:forEach>
                                    </select>


                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">银行卡卡号</label>
                                <div class="layui-input-inline">
                                    <input type="text" value="${bank.bankCard}" name="bankCard" required  lay-verify="required" placeholder="请输入银行卡卡号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">开户行地址</label>
                                <div class="layui-input-inline">
                                    <input type="text"value="${bank.bankAddr}" name="bankAddr" required  lay-verify="required" placeholder="请输入开户行地址" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">预留手机号</label>
                                <div class="layui-input-inline">
                                    <input type="text" value="${bank.phone}" name="phone" required  lay-verify="required" placeholder="请输入预留手机号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">证件号</label>
                                <div class="layui-input-inline">
                                    <input type="text" value="${bank.idcard}" name="idcard" required  lay-verify="required" placeholder="请输入证件号" autocomplete="off" class="layui-input">
                                    <br>
                                    <button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
                                </div>
                                <div class="layui-input-inline">
                                    <div class="layui-form-item">

                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/layuiadmin/layui/layui.js"></script>

<script src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/sx/login/jquery3.4.js"></script>
<script type="text/javascript" src="/js/sx/login/jquery.form.js"></script>
<script type="text/javascript" src="/js/sx/login/common.js"></script>
<script type="text/javascript" src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            $.ajax({
                type: "post",
                url: "/cash/addBank",
                async: false,//同步提交。不设置则默认异步，异步的话，最后执行ajax
                data: $('#bankForm').serialize(),
                success: function (ev) {
                    //code = ev.code;
                    window.location.href="/cash/showBankList";
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
